package com.foreknow.elmboot.controller;

import com.foreknow.elmboot.po.Business;
import com.foreknow.elmboot.service.BusinessService;
import com.foreknow.elmboot.service.impl.BusinessServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
//@RestController = @Controller + @ResponseBody 表示向前端返回json数据
@RestController
@RequestMapping("/BusinessController")
public class BusinessController {
    @Autowired
    private BusinessService businessService;

    /**
     * 根据orderTypeId查询商家的信息
     * @param business
     * @return Object(list extends Object)
     */
    @RequestMapping("/listBusinessByOrderTypeId")
    public Object listBusinessByOrderTypeId(Business business) {
        return businessService.listBusinessByTypeId(business.getOrderTypeId());
    }

    /**
     * 根据businessId查询某一个商家的信息
     * @param business
     * @return Business对象
     */
    @RequestMapping("/getBusinessById")
    public Object getBusinessById(Business business) {
        return businessService.getBusinessById(business.getBusinessId());
    }
}
